def fun_chekout(money):
    money_old = sum(money)
    money_new = money_old
    if 500 <= money_old < 1000:
        money_new = '{:2f}'.format(money_old * 0.9)
    elif 1000 <= money_old <= 2000:
        money_new = '{:2f}'.format(money_old * 0.8)
    elif 2000 <= money_old <= 3000:
        money_new = '{:2f}'.format(money_old * 0.7)
    elif money_old >= 3000:
        money_new = '{:2f}'.format(money_old * 0.6)
    return money_old,money_new
#***************************调用函数***********************#
print("\n开始结算....\n")
list_money = []
while True:
    # 请不要输入非法的金额，否则将抛出异常
    inmoney = float(input("输入商品金额 （输入0表示输入完毕）：")) 
    if int(inmoney)==0:
        break
    else:
        list_money.append(inmoney)
money = fun_chekout(list_money)
print("合计金额：",money[0],"应付金额：",money[1])